package com.tanhua.server.service;

import com.tanhua.dubbo.api.DemoApi;
import com.tanhua.dubbo.api.TestResultApi;
import com.tanhua.model.mongo.Demo;
import com.tanhua.model.mongo.TestResult;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestSoulService {
    @DubboReference
    DemoApi demoApi;
    @DubboReference
    TestResultApi testResult;



    //获取测试题
    public List<Demo> gettestSoul() {
        List<Demo> demos = demoApi.gettestSoul(UserHolder.getUserId());
        return demos;
    }

    //测试结果
    public ResponseEntity testreport(String id) {
        TestResult testreport = testResult.testreport(id);
        System.out.println(testreport);
        return ResponseEntity.ok(testreport);
    }
}
